package com.wanmait.wanmarecruit.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
* Created by Mybatis Generator 2022/09/19
*/
@Data
@TableName(value = "student_cadre_experience")
public class StudentCadreExperience implements Serializable,Comparable<StudentCadreExperience> {
    /**
     * 学生干部经历id
     */
     @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Integer userId;
    @TableField(exist = false)
    private User user;

    /**
     * 干部等级
     */
    @TableField(value = "rank_of_cadre")
    private String rankOfCadre;

    /**
     * 开始时间
     */
    @TableField(value = "begin_time")
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date beginTime;

    /**
     * 结束时间
     */
    @TableField(value = "end_time")
    @DateTimeFormat(pattern = "yyyy-MM")
    private Date endTime;

    @TableField(value = "introduction")
    private String introduction;

    private static final long serialVersionUID = 1L;

    public static final String COL_USER_ID = "user_id";

    public static final String COL_RANK_OF_CADRE = "rank_of_cadre";

    public static final String COL_BEGIN_TIME = "begin_time";

    public static final String COL_END_TIME = "end_time";

    @Override
    public int compareTo(StudentCadreExperience o) {
        long cha = this.getEndTime().getTime()-o.getEndTime().getTime();
        if (cha>0)
        {
            return 1;
        }
        return -1;
    }
}